<% var headContent = { %> <%
include("/template/mtg/includes/header.html"){} %>

<script type="text/javascript">
<!--
function loadPicimageCode() {
	document.getElementById("picimageCode").src = jflyfox.BASE_PATH + 'front/image_code?ran=' + Math.random();
}


function oper_save(){
	var qq = $('[name="model.qq"]').val();
	var email = $('[name="model.email"]').val();
	var telphone = $('[name="model.telphone"]').val();
	if(qq.length>100){
		alert('qq内容太长');
		return false;
	}
	if(email.length>100){
		alert('email内容太长');
		return false;
	}
	if(telphone.length>100){
		alert('手机号内容太长');
		return false;
	}
	
	
	if(telphone=='' && email=='' && qq==''){
		alert('清填写一种联系方式');
		return false;
	}
	
	
	if($('[name="model.remark"]').val()==''){
		alert('意见内容不能为空');
		return false;
	}
	if($('[name="model.remark"]').val().length>400){
		alert('意见内容太长');
		return false;
	}
	
	var imageCode = $('[name="imageCode"]').val();
	if(imageCode==''){
		alert('验证码不能为空！');
		return;
	}
	if(imageCode.length != 4){
		alert('验证码输入错误！');
		return;
	}
	
	jQuery.ajax({
		type:'POST',
		url:jflyfox.BASE_PATH + 'front/advice/save',
		data:$("form").serialize(),
		success:function(data){
			if(data.status==1){
				alert('感谢您的提交，我们会尽快处理');
				$('input:text').val('');
				$('input[name="model.email"]').val('');
				$('textarea').val('');
				loadPicimageCode();
			} else {
				alert('提交失败：'+data.msg);
			}
		},
		error:function(html){
			var flag = (typeof console != 'undefined');
			if(flag) console.log("服务器忙，提交数据失败，代码:" +html.status+ "，请联系管理员！");
			alert("服务器忙，提交数据失败，请联系管理员！");
		}
	});
}
//-->
</script>	
<% }; var bodyContent = { %> <%
include("/template/mtg/includes/header_menu.html"){} %>



<div class="container">
	
	<div class="row">
		<div class="col-md-12">	
	
		<div class="panel panel-default">
			 <div class="panel-body" style="padding:0px;">
			<ol class="breadcrumb" style="margin:0px;">
			  <li><a href="${BASE_PATH }home.html">首页</a></li>
			  <li>意见反馈</li>
			</ol>
			</div>
		</div>
	
		</div>
	</div>
	
	<div class="row">
		<div class="col-md-8">
		
		<div class="panel panel-default">
		  <div class="panel-heading">
			<h3 class="panel-title">意见反馈</h3>
		  </div>
		   <div class="panel-body">
		  		<% if(isEmpty(session.session_user)) { %>
		  			<div class="form-group">
					    <div class="col-sm-offset-2 col-sm-12">
					     没有<a href="${BASE_PATH }front/login">登录</a>不能进行意见反馈，请您<a href="${BASE_PATH }front/login">登录</a>
					    </div>
					</div>
		  		<% } else { %>
				<form class="form-horizontal" name="form1" action="" method="post">
						
						 <div class="form-group">
						    <label for="username" class="col-sm-2 control-label">登录名</label>
						    <div class="col-sm-10">
						    	${isEmpty(session.session_user)?'':session.session_user.realname!'' }
						    </div>
						  </div>
						  <div class="form-group">
							    <label for="qq" class="col-sm-2 control-label">QQ</label>
							    <div class="col-sm-10">
							      <input name="model.qq" type="text" class="form-control" id="tel" 
							      	value="" placeholder="QQ" maxlength="200">
							    </div>
							  </div>
						  <div class="form-group">
							    <label for="email" class="col-sm-2 control-label">email</label>
							    <div class="col-sm-10">
							    	<input name="model.email" class="form-control" type="email" id="email" 
							    		value=""  placeholder="Email" maxlength="200">
							    </div>
							  </div>
							<div class="form-group">
							    <label for="telphone" class="col-sm-2 control-label">手机号</label>
							    <div class="col-sm-10">
							      <input name="model.telphone" type="text" class="form-control" id="tel" 
							      	value="" placeholder="手机号" maxlength="200">
							    </div>
							  </div>
							  
							
							  <div class="form-group">
							    <label for="remark" class="col-sm-2 control-label">意见反馈</label>
							    <div class="col-sm-10">
							    	<textarea rows="12" cols="30" class="form-control" id="remark"
									 name="model.remark" maxlength="1000" placeholder="意见反馈"></textarea>
							    </div>
							  </div>
							
							<div class="form-group">
						    <label for="imageCode" class="col-sm-2 control-label">验证码</label>
						    <div class="col-sm-10">
						      <div class="input-group">
						      	 <input name="imageCode" type="text"  class="form-control" id="imageCode" placeholder="验证码">
						      	 <div class="input-group-addon" style="padding:2px;">
						      			<img id="picimageCode" align="middle" width="60" height="26"  
						      				 style="line-height: 18px;cursor:pointer;"
								 			 src="${BASE_PATH }front/image_code" title="更换一张验证码图片" onclick="loadPicimageCode()"/>
							     </div>
							    </div>
						     
						    </div>
						  </div>
						  
						  
						   <div class="form-group">
							    <div class="col-sm-offset-2 col-sm-10">
							      <input type="button" value="提 交"  class="btn btn-primary" onclick="oper_save();"/>
										&nbsp;&nbsp;&nbsp;&nbsp;
								  <input type="reset" value="重 置"  class="btn btn-default" />
							    </div>
							</div>
							<div class="form-group">
							    <div class="col-sm-offset-2 col-sm-10">
							      1. 欢迎提出您宝贵的意见。<br>
							    </div>
							</div>
						
						</form>
					<% } %>
				</div>
			</div>
		</div>
		
		<div class="col-md-4">
			<!-- 推荐文章 -->
			<%  include("/template/mtg/includes/recommend.html"){} %>
			
			<!-- 友情链接 -->
		  	<%  include("/template/mtg/includes/friendly.html"){} %>
		</div>
		
	</div>
</div>

						
<%  include("/template/mtg/includes/footer.html"){} %>
	
<a id="scrollTop" href="javacript:void(0);" title="返回顶部" style="display: inline;"></a>
	
<%}; %>

<% layout("/pages/template/_layout.html",{head:headContent,body:bodyContent}){ %>
<%} %>
